﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using Newtonsoft.Json;

public partial class GP : Basic
{
    public string strList = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        strList = sbList().ToString();

    }

    protected StringBuilder sbList()
    {
        StringBuilder sb = new StringBuilder();
        try
        {
            string codes = OTO.ToStr(Request["c"]);
            List<GgPhEnty> list = new List<GgPhEnty>();
            list = JsonConvert.DeserializeObject<List<GgPhEnty>>(Pub.LoadData(jsonUrl + "hangqing/gglb.ashx?action=gpph_stock&code=" + codes));
           

            sb.AppendLine("<div class=\"hqzx_cpxh_lt hqzx_cpxh_tborder\">");
            sb.AppendLine("<div class=\"hqzx_cpxh_m_2_nav\">");
            sb.AppendLine("<div class=\"index_content_h h3 gray_t hqzx_cpxh_m_t_l\"><img src=\"images/index_ico2.gif\" class=\"img\" />个股股评  </div>");
            sb.AppendLine("<div class=\"r_time gray\">&nbsp;</div>");
            sb.AppendLine("</div>");
            sb.AppendLine("<div class=\"tableLarge\">");

            sb.AppendLine("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" id=\"mainBtable\">");
            sb.AppendLine("<thead>");
            sb.AppendLine("<tr class=\"tableLargeHead\">");
            sb.AppendLine("<td>排序</td>");
            sb.AppendFormat("<td>代码</a></td>");
            sb.AppendLine("<td>股票名称</td>");
            sb.AppendFormat("<td>成交</td>");
            sb.AppendFormat("<td>涨跌幅</td>");
            sb.AppendFormat("<td>５日涨跌</td>");
            sb.AppendFormat("<td>换手率</td>");
            sb.AppendLine("<td>成交额</td>");
            sb.AppendLine("<td>所属行业</td>");
            sb.AppendLine("<td>股评</td>");
            sb.AppendFormat("<td>体检评分</td>");
            sb.AppendLine("</tr>");
            sb.AppendLine("</thead>");
            sb.AppendLine("<tbody> ");


            for (int i = 0; i < list.Count; i++)
            {
                sb.AppendFormat("<tr>");
                sb.AppendFormat("<td>{0}</td>", i + 1);
                sb.AppendFormat("<td><a href=\"gg{0}.shtml\" class=\"b\">{0}</a></td>", list[i].C);
                sb.AppendFormat("<td><a href=\"gg{1}.shtml\" class=\"b\">{0}</a></td>", list[i].N, list[i].C);
                sb.AppendFormat("<td><span ph=\"zdf\">{0}</span></td>", OTO.PerRedGre(list[i].P, 2, "-", ""));
                sb.AppendFormat("<td><span ph=\"zdf5\">{0}</span></td>", OTO.PerRedGre(list[i].F, 2, "-", "%"));
                sb.AppendFormat("<td><span ph=\"qr\">{0}</span></td>", OTO.PerRedGre(list[i].F5, 2, "-", "%"));
                sb.AppendFormat("<td><span ph=\"hsl\">{0}</span></td>", OTO.CoUt(list[i].I, 1, "-"));
                sb.AppendFormat("<td class=\"red\"><span ph=\"cje\">{0}</span></td>", OTO.CoUt(list[i].A, 100000000, "-", 2));
                sb.AppendFormat("<td class=\"\">{0}</td>", list[i].Hymc);
                sb.AppendFormat("<td>{0}</td>", list[i].Qgqp);
                sb.AppendFormat("<td><span class=\"red\">{0}</span></td>", OTO.PerRedGre(list[i].Score, 0, "-", ""));
                sb.AppendFormat("</tr>");
            }
            sb.AppendLine("</tbody>");
            sb.AppendLine("</table>");

            sb.AppendLine("</div>");
            sb.AppendLine("</div>");


        }
        catch
        { }
        return sb;
    }

    protected string ud(string d, string o)
    {
        string rel = "";
        if (d == "1")
        {
            if (o == "1")
                rel = "<span class=\"green\">↓</span>";
            else if (o == "0")
                rel = "<span class=\"red\">↑</span>";
            else
                rel = "";
        }
        return rel;
    }
}